import fetch from 'common/src/utils/fetch'

const api = {
  // 查询列表
  getList(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/list',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查答辩组学生
  getStudent(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/chooseStudents',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查外专业答辩学生
  getForeignStudent(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/chooseOtherSubjectStudents',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查答辩组老师
  getTeacher(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/chooseTeachers',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 新增答辩组
  insert(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/add',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 编辑答辩组
  update(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/edit',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 删除答辩组
  delete(id) {
    return fetch({
      url: '/api/designservice/defenseGroup/delete?id=' + id,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 查看答辩组
  getDetail(id) {
    return fetch({
      url: '/api/designservice/defenseGroup/detail?id=' + id,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 查答辩组老师 学生信息 (type:0 老师、1学生)
  getTeacherStuInfo(id, type) {
    return fetch({
      url: `/api/designservice/defenseGroup/getTeachersAndStudentsInfo?id=${id}&type=${type}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 导出
  export(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/export',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  getExportStatus(key) {
    return fetch({
      url: `/api/designservice/common/exportExcelResult/${key}`,
      method: 'get',
      showMask: false
    })
  },
  // 查学院
  getCollege() {
    let authId = localStorage.getItem('activeAuthId')
    return fetch({
      url: `/api/designservice/common/college?authId=${authId}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 根据毕业年份和学院查专业
  getSubject(data) {
    return fetch({
      url: '/api/designservice/common/findSubject',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看答辩组学生（校管理员）列表
  getViewStudent(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/list',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看答辩安排（学生）列表
  getReplyArrangement(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/getStudentDefenseInfo',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 答辩安排及成绩维护 查我的学生列表
  getMyStuList(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/queryMyDefenseStudent',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 答辩安排及成绩维护 查我的答辩组列表
  getMyGroupList(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/queryMyDefenseGroup',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 答辩安排及成绩维护 我的学生列表导出
  exportMyStu(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/exportMyDefenseStudent',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 答辩安排及成绩维护 我的答辩组 查看（录入成绩）
  getResultDetail(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/detailStudentDefenseResult',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 答辩安排及成绩维护 我的答辩组 保存（提交）成绩
  save(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/saveStudentDefenseResult',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看答辩成绩 查列表
  getResultList(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/queryDefenseResult',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看答辩成绩 导出
  resultExport(data) {
    return fetch({
      url: '/api/designservice/defenseGroup/exportDefenseResult',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看答辩成绩 查评定信息
  getEvaluateInfo(studentId, graduationYear) {
    return fetch({
      url: `/api/designservice/defenseGroup/detailEvaluateInfo?studentId=${studentId}&graduationYear=${graduationYear}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 查校历id
  getCalendarId() {
    return fetch({
      url: '/api/baseresservice/schoolCalendar/currentTermCalendar',
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 查校历信息
  getSchoolCalendar(id) {
    return fetch({
      url: `/api/baseresservice/schoolCalendar/${id}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  getDefenseGroupCommitteeMember(grade, collegeId) {
    return fetch({
      url: `/api/designservice/defenseGroup/getDefenseGroupCommitteeMember?grade=${grade}&collegeId=${collegeId}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  }
}

export default api
